<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" th:href="@{/css/base.css}"/>
    <link rel="stylesheet" th:href="@{/css/info-mgt.css}"/>
    <link rel="stylesheet" th:href="@{/css/WdatePicker.css}"/>
    <title>选课系统</title>
    <script type="text/javascript" th:src="@{/js/jquery.js}"></script>
    <style type="text/css">
        a:link {
            font-size: 12px;
            color: #000000;
            text-decoration: none;
        }

        a:visited {
            font-size: 12px;
            color: #000000;
            text-decoration: none;
        }

        a:hover {
            font-size: 12px;
            color: #999999;
            text-decoration: none;
        }
    </style>
</head>

<body>
<div class="title"><h2>我的通知</h2></div>
<div class="table-box">

    <table>
        <thead>
        <tr>
            <th class="num">序号</th>
            <th class="name">课程名称</th>
            <th class="node">学分</th>
            <th class="node">老师</th>
            <th class="node">总人数</th>
            <th class="node">已报人数</th>
            <th class="node">开始时间</th>
            <th class="node">结束时间</th>
            <th class="node">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="course, courseStart : ${courseList}">
            <td th:text="${courseStart.count}">1</td>
            <td class="name" th:text="${course.courseName}"></td>
            <td class="node" th:text="${course.courseScore}"></td>
            <td class="node" th:text="${course.teacher}"></td>
            <td class="node" th:text="${course.totalCount}"></td>
            <td class="node" th:text="${course.selectCount}"></td>
            <td class="node" th:text="${#dates.format(course.startTime, 'yyyy-MM-dd')}"></td>
            <td class="node" th:text="${#dates.format(course.endTime, 'yyyy-MM-dd')}"></td>
            <td class="node"><a style="color:blue" th:onclick="quit([[${course.courseId}]], [[${course.courseName}]])">退课</a></td>
        </tr>
        </tbody>

    </table>
</div>

</body>

<script type="text/javascript" th:src="@{/js/common.js}"></script>
<script type="text/javascript" th:src="@{/js/WdatePicker.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.pagination.js}"></script>
<script type="text/javascript">
    function quit(courseId, courseName) {
        if(confirm("确认退出课程：" + courseName + "?")){
            $.ajax({
                url: "../course/quit",
                type: "post",
                dataType: "json",
                data: {"courseId": courseId},
                success: function (data) {
                    alert(data.msg);
                }
            });
        }
    }

    $("tbody").find("tr:odd").css("backgroundColor", "#eff6fa");

    showRemind('input[type=text], textarea', 'placeholder');
</script>
</html>
